﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSTree.fuctions;

namespace TSTree
{
    interface INode
    {
        int getNoOfData(); // returns number of data entries
        // behind that node
        TSData get(int i);   // returns the i-th object in the 
        // tree lying behind that node

        void readFromBuffer(byte[] buffer);
        // reads data from buffer
        void writeToBuffer(byte[] buffer);
        // writes data to buffer

        bool isDataNode();	// returns TRUE, if "this" is RTDataNode 

        float[] getMBR();      // returns mbr enclosing whole page
   
        void print();          // prints rectangles

        void nearestNeighborSearch(TSPoint point, TSPoint nearest, float nearestDistance);

        void nearestNeighborSearch(TSPoint point, SortedLinList res, float nearestDistance);

        void pointQuery(TSPoint p, SortedLinList res);

        void rangeQuery(float[] mbr, SortedLinList res);

        void rangeQuery(TSPoint center, float radius, SortedLinList res);

        void ringQuery(TSPoint center, float radius1, float radius2, SortedLinList res);

        void range_nnQuery(float[] mbr, SortedLinList res,
               TSPoint center, float nearestDistance,
               TSPoint nearest, bool success);

        void overlapping(float[] p, int[] nodes_t);
        void nodes(int[] nodes_a);
        /************************************************************************/
        /*  inserts d recursively, if there occurs a split, FALSE will be
            returned and in sn a pointer to the new node                                                                     */
        /************************************************************************/
        int insert(TSData d, TSNode[] sn);


        /************************************************************************/
        /* prints all entries sectioning mbr                                                                     */
        /************************************************************************/
        void region(float[] mbr);
        //prints all entries equal to p
        void pointQuery(float[] p);

        // void constraints_query(rectangle rect, double[] distance, short direction, short MBRtopo, short topology, SortedLinList res);

        void delete();
    }
}
